/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.example.declex.model;


import com.activeharmony.util.Log;
import com.dspot.declex.annotation.AfterLoad;
import com.dspot.declex.annotation.AfterPut;
import com.dspot.declex.annotation.ServerModel;
import com.dspot.declex.annotation.ServerRequest;
import com.dspot.declex.event.RestBeanEvent_;

import static com.dspot.declex.actions.Action.$Toast;

@ServerModel(
    baseUrl = "http://api.btstu.cn",//翻译API
    load = {
        @ServerRequest(
            action = "/tst/api.php?text={query}"
        ),

    }
)
public class RestBean {
    int code;
    String text;
    String tst;

    @AfterLoad
    void executeAfterLoad() {//注入之后
        RestBeanEvent_.create().setResult(toString()).postEvent();
    }

    @AfterPut
    void executeAfterPut() {
    }

    @Override
    public String toString() {
        return "RestBean{" +
            "code=" + code +
            ", text='" + text + '\'' +
            ", tst='" + tst + '\'' +
            '}';
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getTst() {
        return tst;
    }

    public void setTst(String tst) {
        this.tst = tst;
    }

}
